﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace StrategyGame
{
	/// <summary>
	/// Utility class for drawing single-color rectangles and rectangular borders
	/// </summary>
	class SpriteRectangle
	{
		#region Static resources

		public static Texture2D DummyTexture { get; private set; }

		static public void LoadContent(GraphicsDevice graphics)
		{
			DummyTexture = new Texture2D(graphics, 1, 1);

			DummyTexture.SetData(new Color[] { Color.White });
		}

		#endregion

		#region Rendering

		static public void Draw(SpriteBatch sprites, Rectangle draw_rect, Color draw_color)
		{
			sprites.Draw(DummyTexture, draw_rect, draw_color);
		}

        static public void DrawOutline(SpriteBatch sprites, Rectangle draw_rect, Color draw_color, int line_width)
        {
            sprites.Draw(DummyTexture, new Rectangle(draw_rect.Left, draw_rect.Top, line_width, draw_rect.Height), draw_color); // Left
            sprites.Draw(DummyTexture, new Rectangle(draw_rect.Right, draw_rect.Top, line_width, draw_rect.Height), draw_color); // Right
            sprites.Draw(DummyTexture, new Rectangle(draw_rect.Left, draw_rect.Top, draw_rect.Width, line_width), draw_color); // Top
            sprites.Draw(DummyTexture, new Rectangle(draw_rect.Left, draw_rect.Bottom, draw_rect.Width, line_width), draw_color); // Bottom
		}

		#endregion
	}
}
